import {req_get_auth, req_post_auth} from "./axiosFun.js";
import {HOST} from '@/api/hosts'

export const createTrip = (data) => {
    return req_post_auth("post", `${HOST}/trip/create`, data);
};

export const startTrip = (params) => {
    return req_post_auth("put", `${HOST}/trip/start`, params);
};

export const endTrip = (params) => {
    return req_post_auth("put", `${HOST}/trip/end`, params);
};
export const getAllTrips = (params) => {
    const url = `${HOST}/trip/page`;
    return req_get_auth("get", url, params);
};

export const listTrips = (params) => {
    const url = `${HOST}/trip`;
    return req_get_auth("get", url, params);
};
export const addTrip = (data) => {
    const url = `${HOST}/trip`;
    return req_post_auth("post", url, data);
};

export const deleteTrip = (id) => {
    const url = `${HOST}/trip/${id}`;
    return req_post_auth("delete", url);
};

export const updateTrip = (data) => {
    const url = `${HOST}/trip`;
    return req_post_auth("put", url, data);
};